package cn.chengpengper.unit19.client.handler;

import cn.chengpengper.unit19.protocol.response.JoinGroupResponsePacket;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;

/**
 * @author huchengpeng
 */
@ChannelHandler.Sharable
public class JoinGroupResponseHandler extends SimpleChannelInboundHandler<JoinGroupResponsePacket> {

    public static final JoinGroupResponseHandler INSTANCE = new JoinGroupResponseHandler();

    protected JoinGroupResponseHandler(){}

    @Override
    protected void channelRead0(ChannelHandlerContext ctx, JoinGroupResponsePacket responsePacket) throws Exception {
        if(responsePacket.isSuccess()){
            System.out.println("加入群["+responsePacket.getGroupId()+"]成功");
        }else {
            System.out.println("加入群["+responsePacket.getGroupId()+"]失败");
        }
    }
}
